

local group = {}
function shop_add_panel(unit)
    local panel = group[unit.handle]
    if panel==nil then
        panel = class.panel:builder
        {
            x = -800,
            y = -200,
            w = 120,
            h = 40,
            show_flag = false,
            world_anchor = 'top',
            parent = ac.frame.portrait,
            -- back = {
            --     type = 'panel',
            --     fdf = 'tooltip_backdrop1',
            --     h = 40,
            -- }
            update = function(self)
                local player = ac.player.self
                local unit = self.world_widget
                local title = unit.ui_title or unit.title or unit:get_name()
                if self.title.text~=title then
                    self.title:set_text(title)
                end
            end
        }
        panel.title = panel:add_text(unit.title or unit.name,-100,0,panel.w+200,40,12,2)
    end
    group[unit.handle] = panel
    panel:hide()
    panel:bind_world(unit)
    japi.SetUnitPressUIVisible(unit.handle,false)
end


ac.hardware:on "界面绘制" (function ()
    for handle,panel in pairs(group) do
        if panel:is_show() then
            panel:update()
        end
    end
end)